Add --skip_authors and --skip_terms as additional flags#115
Add --skip_authors and --skip_terms as additional flags#115kiranpotphode wants to merge 9 commits intowp-cli:mainfrom
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to skip authors and terms (categories, tags, custom taxonomy terms, and nav menu terms) from WordPress export files. The implementation follows the existing pattern used by the --skip_comments flag.
Key Changes:
- Added
--skip_authorsand--skip_termscommand-line flags - Implemented exclusion mechanism in
WP_Export_Split_Files_Writerto filter out specified sections - Modified
before_posts()method signature to accept available sections parameter
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Export_Command.php | Added CLI parameters and validation methods for --skip_authors and --skip_terms flags, populating the $exclude array based on user input |
| src/WP_Export_Split_Files_Writer.php | Implemented section exclusion logic and updated before_posts() call to pass filtered sections |
| features/export.feature | Added test scenarios for the new skip flags |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if ( ! empty( $writer_args['exclude'] ) ) { | ||
| foreach ( $writer_args['exclude'] as $exclude ) { | ||
| $key = array_search( $exclude, $this->available_sections, true ); | ||
| if ( false !== $key ) { | ||
| unset( $this->available_sections[ $key ] ); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The exclusion logic removes sections from $this->available_sections after it has already been used to calculate $this->subsequent_sections (line 45). This means excluded sections will still be present in subsequent files when using --include_once. The exclusion logic should be moved before line 44 to ensure excluded sections are properly removed from both $this->available_sections and $this->subsequent_sections.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
This PR introduces
--skip_authorsand--skip_termsflags forwp exportcommand.Fixes: #72